package ltd.smallwang;

import org.assertj.core.api.Assertions;
import org.junit.jupiter.api.Test;

/**
 * @author justd
 * @date 2024-11-23 09:12
 */
class Leetcode0054Test {

  private final Leetcode0054 leetcode0054 = new Leetcode0054();

  @Test
  void spiralOrder01() {
    int[][] matrix = new int[][]{{1, 2, 3}, {4, 5, 6}, {7, 8, 9}};
    Assertions.assertThat(leetcode0054.spiralOrder(matrix))
        .containsExactly(1, 2, 3, 6, 9, 8, 7, 4, 5);
  }

  @Test
  void spiralOrder02() {
    int[][] matrix = new int[][]{{1, 2, 3, 4}, {5, 6, 7, 8}, {9, 10, 11, 12}};
    Assertions.assertThat(leetcode0054.spiralOrder(matrix))
        .containsExactly(1, 2, 3, 4, 8, 12, 11, 10, 9, 5, 6, 7);
  }
}